//
//  TMemIniFile.h
//  UltraStarDeluxeIOS
//
//  Created by 李 杰军 on 12-7-16.
//  Copyright (c) 2012年 DoReiMi. All rights reserved.
//

#ifndef UltraStarDeluxeIOS_TMemIniFile_h
#define UltraStarDeluxeIOS_TMemIniFile_h

#include <map.h>

class TMemIniFile
{
public:
    TMemIniFile();
    virtual ~TMemIniFile();
    
    // load from a filename
    void load(const std::string& filename, const std::string& separators = "\t:=", bool trimWhitespace = true);
    
    // load from a filename
    void loadDirect(const std::string& filename, const std::string& separators = "\t:=", bool trimWhitespace = true);
    
    /**
     * Gets the first setting from the file with the named key.
     */
    std::string getString(const std::string& key, const std::string& section = "", const std::string& defaultValue = "") const;
    
    typedef std::multimap<std::string, std::string> SettingsMultiMap;
    typedef std::map<std::string, SettingsMultiMap*> SettingsBySection;
    
    /** Clear the settings */
    void clear();
    
protected:
    SettingsBySection mSettings;
};

#endif
